package org.vergil.core.guava;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.vergil.config.SystemConfig;
import org.vergil.core.guava.Thread.GetThread;
import org.vergil.core.guava.Thread.SetThread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by vergil on 4/23/17.
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(SystemConfig.class);

        GetThread getThread = context.getBean(GetThread.class);
        SetThread setThread = context.getBean(SetThread.class);


        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(setThread);
        executorService.execute(setThread);
        executorService.execute(setThread);


        executorService.execute(getThread);
        executorService.execute(getThread);
        executorService.execute(getThread);
        executorService.execute(getThread);
        executorService.execute(getThread);
        executorService.execute(getThread);
//        System.out.print(1);
    }
}
